//
//  WDCover.m
//  Zhihuijinfu
//
//  Created by 王笛 on 2016/12/26.
//  Copyright © 2016年 王笛. All rights reserved.
//

#import "WDCover.h"

@implementation WDCover

+ (void)show
{
    // 设置父控件的透明度会影响子控件
    
    WDCover *cover = [[WDCover alloc] initWithFrame:CGRectMake(WDScreenW * 0.6, 0, WDScreenW * (1 - 0.6), WDScreenH)];
    
    cover.backgroundColor = [UIColor blackColor];
    
    cover.alpha = 0.3;
    
    [[UIApplication sharedApplication].keyWindow addSubview:cover];
}

+(void)hide
{
    // 移除蒙版
    for (UIView *childView in [UIApplication sharedApplication].keyWindow.subviews) {
        if ([childView isKindOfClass:self]) {
            [childView removeFromSuperview];
        }
    }
}

@end
